<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0%;
        }

        input {
            list-style: none;
            display: block;
            width: 100px;
            height: 60px;
            margin: 0;
            padding: 0;
            border: 0;
        }

        button {
            outline: none;
            margin: 0;
            padding: 0;
            display: block;
            width: 100px;
            height: 60px;
            font-size: 20px;
        }

        .container {
            width: 500px;
            height: 300px;
            background-color: blanchedalmond;
            display: flex;
        }

        div {
            width: 100px;
            height: 60px;
            line-height: 60px;
            text-align: center;
        }

        .left {
            background-color: blue;
        }

        .center {
            font-size: 20px;
            /* line-height: 60px; */
            /* text-align: center; */
        }

        .right {
            background-color: red;
        }

        .answer {
            background-color: rosybrown;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="left">
            <input type="text" class="left2">
        </div>
        <div class="center">
            <span>+</span>
        </div>
        <div class="right">
            <input type="text" class="right2">
        </div>
        <button>=</button>
        <div class="answer">
            <span></span>
        </div>
    </div>
    <script>
        //  要求：
        //  定义  add  函数，
        //  改变实现，获取两个输入框的值，并且计算两个数值相加的结果
        //  点击“=”标签 ，调用add函数，显示计算的结果
        var left = document.querySelector(".left2");
        var right = document.querySelector(".right2");
        var btn = document.querySelector("button");
        var answer = document.querySelector(".answer");
        alert("请输入两个值");
        var add = function () {
            var zuo = parseInt(left.value);
            var you = parseInt(right.value);
            var count = (zuo + you);
            answer.children[0].innerText = count;

        }

        btn.onclick = function () {
            add();
        }
    </script>
</body>

</html>